

Component({
  /**
   * 组件的属性列表
   */
  properties: {
    hasDatetime: {
      type: Boolean,
      default: false
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    minHour: 10,
    maxHour: 20,
    minDate: new Date(1970, 1, 1).getTime(),
    maxDate: new Date(2100, 10, 1).getTime(),
    currentDate: new Date().getTime(),
    formatter(type, value) {
      if (type === 'year') {
        return value + '年'
      } else if (type === 'month') {
        return value + '月'
      } else if (type === 'day') {
        return value + '日'
      } else if (type === 'hour') {
        return value + '时'
      } else if (type === 'minute') {
        return value + '分'
      } else if (type === 'second') {
        return value + '秒'
      }
      return value
    }
  },

  /**
   * 组件的方法列表
   */
  methods: {
    handleConfirm(value) {
      this.triggerEvent('datatimeConfirm', value.detail)
    },
    handleCancel() {
      this.triggerEvent('datatimeCancel')
    },
    handleClickOverlay() {
      this.triggerEvent('datatimeMark')
    }
  }
})
